#include "Engine.h"
#include "Process.h"
#include "Core.h"
#include "Base.h"

//-------------------------------------------------
CEngine::CEngine()
	: m_pProcess(NULL)
	, m_pCore(NULL)
	, m_pLogger(NULL)
	, m_Clock(30)
{

}

//-------------------------------------------------
CEngine::~CEngine()
{
	CHECKED_DELETE(m_pCore);
	CHECKED_DELETE(m_pLogger);
}

//-------------------------------------------------
void CEngine::Initialize(HWND _hWnd)
{
	m_pLogger	= new CLogger();
	m_pCore		= new CCore();

	m_pCore->Initialize(_hWnd);
	m_pProcess->Initialize();
}

//-------------------------------------------------
void CEngine::Update()
{
	m_Clock.Update();
	float l_fElapsedTime = m_Clock.GetElapsedTime();

	m_pCore->Update(l_fElapsedTime);
	m_pProcess->Update(l_fElapsedTime);
}

//-------------------------------------------------
void CEngine::Render()
{
	m_pCore->Render();
	m_pProcess->Render();
}

//-------------------------------------------------
void CEngine::SetProcess(CProcess *_pProcess)
{
	m_pProcess = _pProcess;
}